<?php
class Donvi extends AppModel {
	var $name = 'Donvi';
	var $virtualFields = array('tendonvi' => "CONCAT(Donvi.madv,' - ',Donvi.tendv)");// "CONCAT('<b>Từ</b>: ',DATE_FORMAT(Thoigian.ngaybd,'%d-%m-%y'), ' <b>Đến</b>: ', DATE_FORMAT(Thoigian.ngaykt,'%d-%m-%y'))");
	var $displayField = 'tendonvi';
	
	var $validate = array(
		'madv' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'tendv' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $hasMany = array(
		'Chitieudv' => array(
			'className' => 'Chitieudv',
			'foreignKey' => 'donvi_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Kehoach' => array(
			'className' => 'Kehoach',
			'foreignKey' => 'donvi_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Nhanvien' => array(
			'className' => 'Nhanvien',
			'foreignKey' => 'donvi_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Thuocdv' => array(
			'className' => 'Thuocdv',
			'foreignKey' => 'donvi_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
